import coin.exchange.base.kr_rest.native_public_client_base as npubcb


class DeribitNativePublicClient(npubcb.NativePublicClientBase):
  def __init__(self):
    npubcb.NativePublicClientBase.__init__(
        self, url="https://www.deribit.com/api/v2/public")

  def query_trading_summary_by_currency(self, market_type, currency):
    market_type = market_type.lower()
    if market_type in ('futures', 'options'):
      market_type = market_type[:-1]
    params = {'currency': currency, 'kind': market_type}
    return self._get_as_json('get_book_summary_by_currency', params)

  def queryAll(self):
    raise NotImplementedError()


if __name__ == "__main__":
  client = DeribitNativePublicClient()
  print(client.query_trading_summary_by_currency('option', 'BTC').msg)
